package routers

import (
	"net/http"

	"github.com/gin-gonic/gin"

	_ "heyzhima-yt-cpu/docs"
	"github.com/swaggo/gin-swagger"
	"github.com/swaggo/gin-swagger/swaggerFiles"

	"heyzhima-yt-cpu/middleware/jwt"
	"heyzhima-yt-cpu/pkg/export"
	"heyzhima-yt-cpu/pkg/qrcode"
	"heyzhima-yt-cpu/pkg/upload"
	"heyzhima-yt-cpu/routers/api"
	"heyzhima-yt-cpu/routers/api/v1"
)

// InitRouter initialize routing information
func InitRouter() *gin.Engine {
	r := gin.New()
	r.Use(gin.Logger())
	r.Use(gin.Recovery())

	r.StaticFS("/export", http.Dir(export.GetExcelFullPath()))
	r.StaticFS("/upload/images", http.Dir(upload.GetImageFullPath()))
	r.StaticFS("/qrcode", http.Dir(qrcode.GetQrCodeFullPath()))


	r.POST("/auth", api.GetAuth)
	r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
	r.POST("/upload", api.UploadImage)
	r.GET("/ping", v1.Ping)
	r.GET("/getConfig", v1.GetConfig)
	r.GET("/getCardInfo", v1.GetCardInfo)
	r.GET("/activeCard", v1.ActiveCard)
	apiv1 := r.Group("/api/v1")

	apiv1.Use(jwt.JWT())
	{


	}
	return r
}
